package cn.admin.configcenter.registry.service.push;

import cn.admin.config.common.Revision;
import cn.admin.configcenter.registry.common.info.ClientConnection;
import cn.admin.configcenter.registry.common.info.GroupId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.concurrent.Semaphore;

public class PushExecuteTask implements Runnable {

    private static final Logger log = LoggerFactory.getLogger(PushExecuteTask.class);
    private static final long RESP_TIMEOUT = 30000L;
    private final GroupId group;
    private final List<?> dataList;
    private final Revision dataRevision;
    private final ClientConnection dest;
    private final boolean isPushToAll;
    private final PushProfileTime pushProfileTime;
    private final Semaphore semaphore;

    public PushExecuteTask(GroupId group,
                           List<?> dataList, Revision rev, PushProfileTime pushProfileTime,
                           Semaphore semaphore) {
        this.pushProfileTime = pushProfileTime;
        this.group = group;
        this.dataList = dataList;
        this.dataRevision = rev;
        this.dest = null;
        this.isPushToAll = true;
        this.semaphore = semaphore;
    }

    public PushExecuteTask(GroupId group, List<?> dataList,
                           Revision rev, ClientConnection dest,
                           PushProfileTime pushProfileTime, Semaphore semaphore) {
        this.pushProfileTime = pushProfileTime;
        this.group = group;
        this.dataRevision = rev;
        this.dest = dest;
        this.isPushToAll = false;
        this.semaphore = semaphore;
        this.dataList = dataList;
    }

    //TODO

    @Override
    public void run() {

    }
}
